package com.zhentao.controller;

import com.zhentao.model.vo.common.Result;
import com.zhentao.model.vo.common.ResultCodeEnum;
import com.zhentao.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @description:
 * @author: zhentao
 * @create: 2022-03-09 15:09
 **/
@RestController
@RequestMapping("/system")
public class FileUploadController {

    @Autowired
    private SysUserService sysUserService;

    //上传图片文件
    @PostMapping(value = "/fileUpload")
    public Result<String> fileUploadService(MultipartFile file) throws IOException {
        String fileUrl=sysUserService.uploadImages(file);
        return Result.build(fileUrl , ResultCodeEnum.SUCCESS) ;
    }

}
